package com.spring.demo2;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author vhans
 */
@Configuration
public class ConfigBean {

    // bean名称默认为方法名user1
    @Bean
    public User user1() {
        return new User();
    }

    // bean名称为user2Bean
    @Bean("user2Bean")
    public User user2() {
        return new User();
    }

    // bean名称:user3Bean1;别名:[user3Bean2,user3Bean3]
    @Bean({"user3Bean1", "user3Bean2", "user3Bean3"})
    public User user3() {
        return new User();
    }
}
